package com.gexiaobao.pigeon.ui.dialog

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView
import com.gexiaobao.pigeon.R

/**
 * @Author      : hxw
 * @Date        : 2024/6/19 14:58
 * @Describe    :
 */
class RxDialogBackHint(context: Context?) : RxDialog(context!!) {

    private lateinit var tvSure: AppCompatTextView
    private lateinit var tvCancel: AppCompatTextView
    private lateinit var tvDialogTitle: AppCompatTextView
    private lateinit var ivDialogClose: AppCompatImageView

    init {
        initView()
    }

    private fun initView() {
        val dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_default_hint, null)
        tvSure = dialogView.findViewById(R.id.tvSure)
        tvCancel = dialogView.findViewById(R.id.tvCancel)
        tvDialogTitle = dialogView.findViewById(R.id.tvDialogTitle)
        ivDialogClose = dialogView.findViewById(R.id.ivDialogClose)
        ivDialogClose.setOnClickListener {
            dismiss()
        }

        setContentView(dialogView)
    }

    fun setSureViewText(content: String) {
        tvSure.text = content
    }

    fun setCancelViewText(content: String) {
        tvCancel.text = content
    }

    fun setTitleText(content: String) {
        tvDialogTitle.text = content
    }

    fun setCommitListener(listener: View.OnClickListener?) {
        tvSure.setOnClickListener(listener)
    }

    fun setCancelListener(listener: View.OnClickListener?) {
        tvCancel.setOnClickListener(listener)
    }

}